#include<iostream>
using namespace std;
int Min(int *a,int n){
	int min=*a,i;
	for(i=0;i<n;i++)
	    if(a[i]<min)
	        min=a[i]; 
	return min;
}
int Max(int *a,int n){
	int max=*a,i;
	for(i=0;i<n;i++)
	    if(a[i]>max)
	        max=a[i]; 
	return max;
}
int main(){
	int a[]={1,2,3,4,5,6,7,8,9},n=9,average,sum=0;
	for(int i=0;i<9;i++){
		sum+=a[i];
	}
	sum=sum-Min(a,9)-Max(a,9);
	average=sum/(9-2);
	cout<<"average="<<average<<endl;
	return 0;
} 
